<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>common_util: src/common_util/strutil.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">common_util<span id="projectnumber">&#160;1.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function() { init_codefold(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_2961cad218251a7c35c6867350b80887.html">common_util</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">strutil.h</div></div>
</div><!--header-->
<div class="contents">
<a href="strutil_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="keyword">namespace </span>cutl</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span>{</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="strutil_8h.html#a376934c60789f3d7f004fa6f518d369c">   30</a></span>    <span class="keyword">using </span><a class="code hl_typedef" href="strutil_8h.html#a376934c60789f3d7f004fa6f518d369c">strvec</a> = std::vector&lt;std::string&gt;;</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="strutil_8h.html#a3726a74d715fb5d878fe450b64e439c6">   38</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a3726a74d715fb5d878fe450b64e439c6">to_upper</a>(<span class="keyword">const</span> std::string &amp;str);</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="strutil_8h.html#a191b809565dda0b675926b0759e41c4e">   45</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a191b809565dda0b675926b0759e41c4e">to_lower</a>(<span class="keyword">const</span> std::string &amp;str);</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span> </div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"><a class="line" href="strutil_8h.html#a7f0e910cfe8e2aecb529dcb0a4780789">   53</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a7f0e910cfe8e2aecb529dcb0a4780789">lstrip</a>(<span class="keyword">const</span> std::string &amp;str);</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"><a class="line" href="strutil_8h.html#a11c02ddd4eb2a2ca0ec3aa76321920f5">   60</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a11c02ddd4eb2a2ca0ec3aa76321920f5">rstrip</a>(<span class="keyword">const</span> std::string &amp;str);</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"><a class="line" href="strutil_8h.html#a88b6df1e1f47d1accbfefc37dff7da34">   67</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a88b6df1e1f47d1accbfefc37dff7da34">strip</a>(<span class="keyword">const</span> std::string &amp;str);</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"><a class="line" href="strutil_8h.html#a6dfe8573225214ea4e1106dadb486f76">   77</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="strutil_8h.html#a6dfe8573225214ea4e1106dadb486f76">starts_with</a>(<span class="keyword">const</span> std::string &amp;str, <span class="keyword">const</span> std::string &amp;start, <span class="keywordtype">bool</span> ignoreCase = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"><a class="line" href="strutil_8h.html#a12ec77887a1aa7ccd6a2e1d4caf820dc">   86</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="strutil_8h.html#a12ec77887a1aa7ccd6a2e1d4caf820dc">ends_with</a>(<span class="keyword">const</span> std::string &amp;str, <span class="keyword">const</span> std::string &amp;end, <span class="keywordtype">bool</span> ignoreCase = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"><a class="line" href="strutil_8h.html#a21aed1f340f8db81592fc712a5f54393">   95</a></span>    <a class="code hl_typedef" href="strutil_8h.html#a376934c60789f3d7f004fa6f518d369c">strvec</a> <a class="code hl_function" href="strutil_8h.html#a21aed1f340f8db81592fc712a5f54393">split</a>(<span class="keyword">const</span> std::string &amp;str, <span class="keyword">const</span> std::string &amp;separator);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"><a class="line" href="strutil_8h.html#a53028b182f613c301ac433fbf3723ac0">  103</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a53028b182f613c301ac433fbf3723ac0">join</a>(<span class="keyword">const</span> <a class="code hl_typedef" href="strutil_8h.html#a376934c60789f3d7f004fa6f518d369c">strvec</a> &amp;strlist, <span class="keyword">const</span> std::string &amp;separator = <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span> </div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"><a class="line" href="strutil_8h.html#a96f118a5cc0f1cc4fef2488e8cbc6631">  111</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a96f118a5cc0f1cc4fef2488e8cbc6631">desensitizing</a>(<span class="keyword">const</span> std::string &amp;str);</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"><a class="line" href="strutil_8h.html#a265b3054919d7e4573eb965044ca7930">  120</a></span>    std::string <a class="code hl_function" href="strutil_8h.html#a265b3054919d7e4573eb965044ca7930">ws2s</a>(<span class="keyword">const</span> std::wstring&amp; ws, <span class="keyword">const</span> std::string&amp; locale = <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno">  121</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"><a class="line" href="strutil_8h.html#a76570cdb2971d9df6a341ace295aaa42">  129</a></span>    std::wstring <a class="code hl_function" href="strutil_8h.html#a76570cdb2971d9df6a341ace295aaa42">s2ws</a>(<span class="keyword">const</span> std::string&amp; s, <span class="keyword">const</span> std::string&amp; locale = <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span> </div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span>} <span class="comment">// namespace cutl</span></div>
<div class="ttc" id="astrutil_8h_html_a11c02ddd4eb2a2ca0ec3aa76321920f5"><div class="ttname"><a href="strutil_8h.html#a11c02ddd4eb2a2ca0ec3aa76321920f5">cutl::rstrip</a></div><div class="ttdeci">std::string rstrip(const std::string &amp;str)</div><div class="ttdoc">Remove trailing whitespaces from a string.</div></div>
<div class="ttc" id="astrutil_8h_html_a12ec77887a1aa7ccd6a2e1d4caf820dc"><div class="ttname"><a href="strutil_8h.html#a12ec77887a1aa7ccd6a2e1d4caf820dc">cutl::ends_with</a></div><div class="ttdeci">bool ends_with(const std::string &amp;str, const std::string &amp;end, bool ignoreCase=false)</div><div class="ttdoc">Check if a string ends with a given substring.</div></div>
<div class="ttc" id="astrutil_8h_html_a191b809565dda0b675926b0759e41c4e"><div class="ttname"><a href="strutil_8h.html#a191b809565dda0b675926b0759e41c4e">cutl::to_lower</a></div><div class="ttdeci">std::string to_lower(const std::string &amp;str)</div><div class="ttdoc">Convert a string to lower case.</div></div>
<div class="ttc" id="astrutil_8h_html_a21aed1f340f8db81592fc712a5f54393"><div class="ttname"><a href="strutil_8h.html#a21aed1f340f8db81592fc712a5f54393">cutl::split</a></div><div class="ttdeci">strvec split(const std::string &amp;str, const std::string &amp;separator)</div><div class="ttdoc">Split a string into a vector of substrings using a given separator.</div></div>
<div class="ttc" id="astrutil_8h_html_a265b3054919d7e4573eb965044ca7930"><div class="ttname"><a href="strutil_8h.html#a265b3054919d7e4573eb965044ca7930">cutl::ws2s</a></div><div class="ttdeci">std::string ws2s(const std::wstring &amp;ws, const std::string &amp;locale=&quot;&quot;)</div><div class="ttdoc">Convert a wide string to a string.</div></div>
<div class="ttc" id="astrutil_8h_html_a3726a74d715fb5d878fe450b64e439c6"><div class="ttname"><a href="strutil_8h.html#a3726a74d715fb5d878fe450b64e439c6">cutl::to_upper</a></div><div class="ttdeci">std::string to_upper(const std::string &amp;str)</div><div class="ttdoc">Convert a string to upper case.</div></div>
<div class="ttc" id="astrutil_8h_html_a376934c60789f3d7f004fa6f518d369c"><div class="ttname"><a href="strutil_8h.html#a376934c60789f3d7f004fa6f518d369c">cutl::strvec</a></div><div class="ttdeci">std::vector&lt; std::string &gt; strvec</div><div class="ttdoc">The type of vector strings used in this library.</div><div class="ttdef"><b>Definition</b> strutil.h:30</div></div>
<div class="ttc" id="astrutil_8h_html_a53028b182f613c301ac433fbf3723ac0"><div class="ttname"><a href="strutil_8h.html#a53028b182f613c301ac433fbf3723ac0">cutl::join</a></div><div class="ttdeci">std::string join(const strvec &amp;strlist, const std::string &amp;separator=&quot;&quot;)</div><div class="ttdoc">Join a vector of strings into a single string using a given separator.</div></div>
<div class="ttc" id="astrutil_8h_html_a6dfe8573225214ea4e1106dadb486f76"><div class="ttname"><a href="strutil_8h.html#a6dfe8573225214ea4e1106dadb486f76">cutl::starts_with</a></div><div class="ttdeci">bool starts_with(const std::string &amp;str, const std::string &amp;start, bool ignoreCase=false)</div><div class="ttdoc">Check if a string starts with a given substring.</div></div>
<div class="ttc" id="astrutil_8h_html_a76570cdb2971d9df6a341ace295aaa42"><div class="ttname"><a href="strutil_8h.html#a76570cdb2971d9df6a341ace295aaa42">cutl::s2ws</a></div><div class="ttdeci">std::wstring s2ws(const std::string &amp;s, const std::string &amp;locale=&quot;&quot;)</div><div class="ttdoc">Convert a string to a wide string.</div></div>
<div class="ttc" id="astrutil_8h_html_a7f0e910cfe8e2aecb529dcb0a4780789"><div class="ttname"><a href="strutil_8h.html#a7f0e910cfe8e2aecb529dcb0a4780789">cutl::lstrip</a></div><div class="ttdeci">std::string lstrip(const std::string &amp;str)</div><div class="ttdoc">Remove leading whitespaces from a string.</div></div>
<div class="ttc" id="astrutil_8h_html_a88b6df1e1f47d1accbfefc37dff7da34"><div class="ttname"><a href="strutil_8h.html#a88b6df1e1f47d1accbfefc37dff7da34">cutl::strip</a></div><div class="ttdeci">std::string strip(const std::string &amp;str)</div><div class="ttdoc">Remove leading and trailing whitespaces from a string.</div></div>
<div class="ttc" id="astrutil_8h_html_a96f118a5cc0f1cc4fef2488e8cbc6631"><div class="ttname"><a href="strutil_8h.html#a96f118a5cc0f1cc4fef2488e8cbc6631">cutl::desensitizing</a></div><div class="ttdeci">std::string desensitizing(const std::string &amp;str)</div><div class="ttdoc">Desensitizing a string by replacing some characters with '*'.</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8
</small></address>
</body>
</html>
